<{include file="header.html"}>
<script type="text/javascript">
function submitFilter()
{document.frm_filter.submit();
	return true;
}
getDatePicker('START_DATE');
getDatePicker('END_DATE');
</script>
	<div class="box_home">
        <div class="box_content">
            <form id='frm_filter' name='frm_filter' method="get" action="">
            <table >
                <tr>
                    <td width="150">Start Date</td>
                    <td><input type="text" class="date" name="START_DATE" id="START_DATE" value="<{$filter.START_DATE}>" onchange="getWorkingHour()" size="15" /></td>
                    <td width="150"><{$smarty.const._LB_TECHNICIAN|utf8_escape_html}>&nbsp;:&nbsp;</td>
                    <td>
                        <select id="TECHNICIAN" name="TECHNICIAN">
                            <option value="0"><{$smarty.const._LB_ALL|utf8_escape_html}></option>
                            <{while $technician->fetch()}>
                            <option value="<{$technician->ID|utf8_escape_html}>" <{if $technician->ID == $filter.ID_TECHNICIAN}>selected="selected"<{/if}>>
                                <{$technician->TITLE|utf8_escape_html}>
                            </option>
                            <{/while}>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>End Date</td>
                    <td><input type="text" class="date" name="END_DATE" id="END_DATE" value="<{$filter.END_DATE}>" onchange="getWorkingHour()" size="15" /></td>
                    <td><{$smarty.const._LB_SERVICE|utf8_escape_html}>&nbsp;:&nbsp;</td>
                    <td>
                        <select id="SERVICE" name="SERVICE">
                            <option value="0"><{$smarty.const._LB_ALL|utf8_escape_html}></option>
                            <{if $sData|count > 0 }>
                            <{foreach from=$sData key=gID item=data}>
                                <{assign var=gTitle value=$data.TITLE}>
                                <{assign var=sDATA value=$data.DATA}>
                                <{if $sDATA|count > 0 }>
                                    <optgroup label="<{$gTitle|utf8_escape_html}>">
                                    <{foreach from=$sDATA key=ID item=item}>
                                    <option value="<{$item.ID|utf8_escape_html}>" <{if $item.ID == $filter.ID_SERVICE}>selected="selected"<{/if}>><{$item.TITLE|utf8_escape_html}> ( <{$item.TIME|utf8_escape_html}> mins - $<{$item.PRICE|utf8_escape_html}> )</option>
                                    <{/foreach}>
                                </optgroup>
                                <{/if}>
                            <{/foreach}>
                            <{/if}>
                            </select>
                    </td>
                    
                </tr>
                <tr>
                    <td><{$smarty.const._LB_STATUS|utf8_escape_html}>&nbsp;:&nbsp;</td>
                    <td>
                        <select id="STATUS" name="STATUS">
                            <option value="-1" <{if $filter.STATUS == -1}>selected="selected"<{/if}>><{$smarty.const._LB_ALL|utf8_escape_html}></option>
                            <option value="0" <{if $filter.STATUS == 0}>selected="selected"<{/if}>><{$smarty.const._LB_WAITING_FOR_APPROVE|utf8_escape_html}></option>
                            <option value="1" <{if $filter.STATUS == 1}>selected="selected"<{/if}>><{$smarty.const._LB_APPROVED|utf8_escape_html}></option>
                            <option value="2" <{if $filter.STATUS == 2}>selected="selected"<{/if}>><{$smarty.const._LB_REJECTED|utf8_escape_html}></option>
                        </select>
                    </td>
                    <td></td>
                    <td></td>
                </tr>
            </table>
				<div style="padding-top:10px;float:left;">
                    <a class="tribullet" href="<{$smarty.const.APPLICATION_URL}>/booking/form/" onclick=""><{$smarty.const._LB_ADD_NEW_BOOKING|utf8_escape_html}></a>
                </div>
                <div class="submit" align="right" style="padding-top:10px;">
                    <a class="tribullet" href="#" onclick="submitFilter()"><{$smarty.const._LB_SEARCH|utf8_escape_html}></a>
                </div>
            </form>
        </div>
	</div>
	<div class="one_one">
		<div class="box_two_third">
		<div class="box_head"><{$smarty.const._LB_BOOKING_MANAGEMENT|utf8_escape_html}></div>
		<div class="box_content">
            <{if $bookList|count > 0 }>
            <table class="reporting" border="1" style="border-collapse: collapse;">
                <tr style="text-align: center;font-weight: bold;">
					<th width="50"><{$smarty.const._LB_MEMBER|utf8_escape_html}></th>
                    <th width="80"><{$smarty.const._LB_FIRST_NAME|utf8_escape_html}></th>
                    <th width="80"><{$smarty.const._LB_LAST_NAME|utf8_escape_html}></th>
					<{if $g_user->isSupervisor()}>
                    <th width="150"><{$smarty.const._LB_EMAIL|utf8_escape_html}></th>
                    <th width="100"><{$smarty.const._LB_TELEPHONE_SHORT|utf8_escape_html}></th>
					<{/if}>
                    <th><{$smarty.const._LB_BOOKING_INFO|utf8_escape_html}></th>
					<th width="100"><{$smarty.const._LB_ACTION|utf8_escape_html}></th>
                </tr>
                <{foreach from=$bookList key=bookingID item=bookDetail}>
                <{assign var=user value=$bookDetail.USER_INFO}>
                <{assign var=techData value=$bookDetail.TDATA}>
                <{assign var=bookStatus value=$bookDetail.STATUS}>
                <tr>
                    <td>
						<{if $user.ID_MEMBER > 0}>
						<{$user.ID_MEMBER|utf8_escape_html}>
						<{/if}>
					</td>
					<td><{$user.FIRST_NAME|utf8_escape_html}></td>
                    <td><{$user.LAST_NAME|utf8_escape_html}></td>
					<{if $g_user->isSupervisor()}>
                    <td><{$user.EMAIL|utf8_escape_html}></td>
                    <td><{$user.PHONE|utf8_escape_html}></td>
					<{/if}>
                    <td>
						<{$smarty.const._LB_STATUS|utf8_escape_html}> : <{$booking->status2Text($bookStatus)}><br />
                        <{foreach from=$techData key=bdID item=data}>
                            <{assign var=techTitle value=$data.TITLE}>
                            <{assign var=sData value=$data.SDATA}>
							<{if $data.TITLE != ""}>
                            <{$smarty.const._LB_TECHNICIAN|utf8_escape_html}>&nbsp;:&nbsp;<{$data.TITLE|utf8_escape_html}><br />
							<{/if}>
                            <{$smarty.const._LB_BOOKING_DATE|utf8_escape_html}>&nbsp;:&nbsp;<{$data.BOOKING_DATE|date_format:"%d/%m/%Y %H:%M"}><br />
                        <{/foreach}>
                    </td>
					<td>
						<a href="<{$smarty.const.APPLICATION_URL}>/booking/detail/?id=<{$bookingID}>"><img src="<{$smarty.const.APPLICATION_URL}>/images/<{$smarty.const.IMAGE_NAME_DETAIL}>" alt="" class="small" title="<{$smarty.const._LB_VIEW|utf8_escape_html}>" /></a>
						<a onclick="return confirm('<{$smarty.const._MSG_BOOKING_DELETE_CONFIRM|utf8_escape_html}>')"  href="<{$smarty.const.APPLICATION_URL}>/booking/delete/?id=<{$bookingID}>">
							<img class="small" src="<{$smarty.const.APPLICATION_URL}>/images/<{$smarty.const.IMAGE_NAME_DELETE_SMALL}>" alt=""  title="<{$smarty.const._LB_DELETE|utf8_escape_html}>" />
						</a>
					</td>
                </tr>
                <{/foreach}>
            </table>
            <{else}>
                <{$smarty.const._LB_NO_ITEM|utf8_escape_html}>
            <{/if}>
		</div>
        <div class="pagination">
            <{$pager->display()}>
        </div>
	</div>
	</div>
<{include file="footer.html"}>